<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<html>
<head>
    <title></title>
    <script src="<s:url value='/common/lib/jquery/jquery-1.3.2.min.js'/>" type="text/javascript"></script>
    <style type="text/css">
		body { 
			font-family: "微软雅黑", "宋体", Arial, sans-serif; 
			font-size: 12px; 
		}
		.btn { 
			background-color:#FFF; 
			border:1px solid #CDCDCD;
			height:22px; 
			width:150px; 
		}
	</style>
    <script type="text/javascript">
        $(function () {
            $("#downloadBox").hide();
        });
        
        function doStatistic() {
        	var y = $("#year").val();
        	var q = $("input[name='quarter']:checked").val();
        	$("#doStatisticBtn").attr("disabled","disabled");
        	$("#downloadBox").show();
        	$("#downloadfile").hide();
        	$.post("<s:url value='/record/doQStatistic.action'/>",{year:y,quarter:q}, function(data) {
        		var r = data.split(":");
				if(r[0] == 0) {
					$("#downloadfile").attr("href","<s:url value='/execl-temp/'/>" + y + "-Q" + q + ".xls");
					$("#downloadfile").text(y + "-Q" + q + ".xls");
					$("#downloadfile").show();
				} else {
					alert("下载出错：" + r[1])
				}
				$("#prepDownloadFile").hide();
				$("#doStatisticBtn").attr("disabled","");
			});
        }
    </script>
</head>
<body style="padding:10px">
	<h3>生成季度统计表</h3>
	<div style="width:100%; height:auto;">
		<div id="yearBox" style="margin: 5px;">
			<label id="yearLabel" for="year">请选年份：</label>
			<select id="year">
				<option value="2010">2010</option>
				<option value="2011">2011</option>
				<option value="2012">2012</option>
				<option value="2013" selected="selected">2013</option>
				<option value="2014">2014</option>
				<option value="2015">2015</option>
				<option value="2016">2016</option>
				<option value="2017">2017</option>
				<option value="2018">2018</option>
				<option value="2019">2019</option>
				<option value="2020">2020</option>
				<option value="2021">2021</option>
				<option value="2022">2022</option>
				<option value="2023">2023</option>
				<option value="2024">2024</option>
				<option value="2025">2025</option>
			</select>
		</div>
		<div id="quarterBox" style="margin: 5px;">
			<label id="quarterLabel" for="quarter">请选季度：</label>
			<input id="quarter" type="radio" value="1" name="quarter" checked="checked">一季度</input>
			<input type="radio" value="2" name="quarter">二季度</input>
			<input type="radio" value="3" name="quarter">三季度</input>
			<input type="radio" value="4" name="quarter">四季度</input>
		</div>
		<div id="inputBox" style="margin: 5px;">
			<input id="doStatisticBtn" type="button" onclick="doStatistic()" class="btn" value="统计"></input>
		</div>
		<div id="downloadBox" style="margin: 5px;">
			<label id="prepDownloadFile">正在统计数据，请稍后...</label>
			<a id="downloadfile" target="_blank" title="请点击鼠标右键，选择链接另存为"></a>
		</div>
	</div>
</body>
</html>